home *** CD-ROM | disk | FTP | other *** search
- head 1.4;
- branch ;
- access ;
- symbols sprited:1.4.1;
- locks ; strict;
- comment @ * @;
-
-
- 1.4
- date 90.03.23.10.29.33; author douglis; state Exp;
- branches 1.4.1.1;
- next 1.3;
-
- 1.3
- date 88.11.11.16.56.04; author brent; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.06.26.17.30.22; author mendel; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.06.19.14.31.52; author ouster; state Exp;
- branches ;
- next ;
-
- 1.4.1.1
- date 91.12.10.15.57.32; author kupfer; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.4
- log
- @just added comment about how check for null char can go away once kernel fix
- propagates.
- @
- text
- @/*
- * readlink.c --
- *
- * Procedure to map from Unix readlink system call to Sprite.
- *
- * Copyright (C) 1986 Regents of the University of California
- * All rights reserved.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/readlink.c,v 1.3 88/11/11 16:56:04 brent Exp Locker: douglis $ SPRITE (Berkeley)";
- #endif not lint
-
- #include "sprite.h"
- #include "fs.h"
- #include "compatInt.h"
-
-
- /*
- *----------------------------------------------------------------------
- *
- * readlink --
- *
- * Procedure to map from Unix readlink system call to Sprite Fs_ReadLink.
- *
- * Results:
- * UNIX_ERROR is returned upon error, with the actual error code
- * stored in errno. Upon success, the number of bytes actually
- * read (ie. the length of the link's target pathname) is returned.
- *
- *
- * Side effects:
- * The buffer is filled with the number of bytes indicated by
- * the length parameter.
- *
- *----------------------------------------------------------------------
- */
-
- int
- readlink(link, buffer, numBytes)
- char *link; /* name of link file to read */
- char *buffer; /* pointer to buffer area */
- int numBytes; /* number of bytes to read */
- {
- ReturnStatus status; /* result returned by Fs_Read */
- int amountRead; /* place to hold number of bytes read */
-
- status = Fs_ReadLink(link, numBytes, buffer, &amountRead);
- if (status != SUCCESS) {
- errno = Compat_MapCode(status);
- return(UNIX_ERROR);
- } else {
- /*
- * Sprite's Fs_ReadLink includes the terminating null character
- * in the character count return (amountRead) while Unix doesn't.
- *
- * ** NOTE ** this check can go away once all hosts are running
- * kernels that fix this before returning the value.
- */
- if (buffer[amountRead-1] == '\0') {
- amountRead--;
- }
-
- return(amountRead);
- }
- }
- @
-
-
- 1.4.1.1
- log
- @Initial branch for Sprite server.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/readlink.c,v 1.4 90/03/23 10:29:33 douglis Exp $ SPRITE (Berkeley)";
- @
-
-
- 1.3
- log
- @Fixed this to understand both null-terminated Sprite links
- and Unix-style unterminated symbolic links
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: readlink.c,v 1.2 88/06/26 17:30:22 mendel Exp $ SPRITE (Berkeley)";
- d55 4
- a58 1
- * in the character count return (amountRead) while Unix doesn't.
- d63 1
- @
-
-
- 1.2
- log
- @Corrected readlink to return the length of the link rather than the
- length of the link and terminating null character.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: readlink.c,v 1.1 88/06/19 14:31:52 ouster Exp $ SPRITE (Berkeley)";
- d57 4
- a60 1
- return(amountRead-1);
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: readlink.c,v 1.1 87/04/26 12:41:04 brent Exp $ SPRITE (Berkeley)";
- d30 1
- d53 5
- a57 1
- return(amountRead);
- @
-